local skel = fk.CreateSkill {
  name = "emo__aoman",
}

Fk:loadTranslationTable{
  ["emo__aoman"] = "傲慢",
  [":emo__aoman"] = "出牌阶段限一次，你可以弃置任意张牌并选择一名其他角色，你控制其视为使用等量种单体基本牌或普通锦囊牌。",
  ["#emo__aoman-prompt"] = "傲慢:弃置任意张牌并选择一名其他角色，你控制其视为使用等量种单体基本牌或普通锦囊牌",
  ["#emo__aoman-use"] = "傲慢：请选择一种牌使用(第%arg张，共%arg2张)",
}

skel:addEffect("active", {
  anim_type = "drawcard",
  prompt = "#emo__aoman-prompt",
  min_card_num = 0,
  target_num = 1,
  card_filter = function (self, player, to_select, selected)
    return not player:prohibitDiscard(to_select)
  end,
  target_filter = function (self, player, to_select, selected)
    return #selected == 0 and to_select ~= player
  end,
  times = function (self, player)
    return 1 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
    and table.find(player:getCardIds("he"), function (id)
      return not player:prohibitDiscard(id)
    end)
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local to = effect.tos[1]
    room:throwCard(effect.cards, skel.name, player, player)
    if player.dead or to.dead then return end
    player:control(to)
    room.logic:getCurrentEvent():addCleaner(function()
      to:control(to)
    end)
    local names = table.filter(Fk:getAllCardNames("bt"), function (name)
      return not Fk:cloneCard(name).multiple_targets
    end)
    local x = #effect.cards
    for i = 1, x do
      local use = room:askToUseVirtualCard(to, {
        name = names, skill_name = skel.name, skip = true, prompt = "#emo__aoman-use:::" .. i .. ":" .. x
      })
      if not use then break end
      table.removeOne(names, use.card.name)
      room:useCard(use)
      if to.dead or #names == 0 then break end
    end
  end,
})

return skel
